﻿using netDxf;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Tables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestDxfDocument

{

    class ISYC_309_05
    {
        public static void ISYC_309_05a_j(Dictionary<string, Object> data)  //内切槽用可转位刀片镗杆a或b图
        {                                                                            
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            /*
            double scale = 2;
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double oal = 46.2 * scale;
            double dconms = 10 * scale;
            double lh = 12.8 * scale;
            double ecd = 3.7 * scale;
            double wf = 12.3 * scale;
            double cw = 4.6 * scale;
            double kw = 2.85 * scale;
            double cdx = 6.4 * scale;
            double bc = 0.4 * scale;
            double eca = 45;
            double eca_ = 45 * pi / 180;
            double lpr = oal / 1.2;
         */
            
            double pi = Math.PI;
            double scale = Convert.ToDouble(data["scale"]);
            string path = Convert.ToString(data["path"]);
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double dconms = Convert.ToDouble(data["dconms"]) * scale;
            double lh = Convert.ToDouble(data["lh"]) * scale;
            double ecd = Convert.ToDouble(data["ecd"]) * scale;
            double wf = Convert.ToDouble(data["wf"]) * scale;
            double cw = Convert.ToDouble(data["cw"]) * scale;
            double kw = Convert.ToDouble(data["kw"]) * scale;
            double cdx = Convert.ToDouble(data["cdx"]) * scale;
            double bc = Convert.ToDouble(data["bc"]) * scale;
            double eca = Convert.ToDouble(data["eca"]);
            double eca_ = eca * pi / 180;
            double lpr = oal / 1.2;
            

            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0_ = new Vector2(oal + 5, 0);

            Vector2 p1 = fun.Polar(p0, pi / 2, dconms / 2.0);
            Vector2 p2 = fun.Polar(p1, 0, oal - lh);
            Vector2 p3 = fun.Polar(p2, pi / -2, bc);
            Vector2 p4 = fun.Polar(p3, 0, lh - ecd - bc);
            Vector2 p5 = new Vector2(oal - bc, p4.Y);
            Vector2 p6;
           

                p6 = new Vector2(p5.X, p0.Y);



          
            Vector2 p7 = fun.Polar(p6, 0, cw / 2.0 - (p5.X - p4.X) / 2.0);
            Vector2 p8 = fun.Polar(p7, pi / -2, kw);
            Vector2 p9 = new Vector2(p6.X, p8.Y);
            Vector2 p10 = fun.mirrorpoint(p5, p0, p0_);
            Vector2 p11 = fun.mirrorpoint(p4, p0, p0_);
            Vector2 p12 = fun.mirrorpoint(p3, p0, p0_);
            Vector2 p13 = fun.mirrorpoint(p2, p0, p0_);
            Vector2 p14 = fun.mirrorpoint(p1, p0, p0_);

            Vector2 p15 = fun.Polar(p7, pi, cw);
            Vector2 p16 = fun.Polar(p6, pi, p5.X - p4.X);
            Vector2 p17 = fun.Polar(p8, pi, cw);
            Vector2 p18 = fun.Polar(p9, pi, p5.X - p4.X);
            #region 可转位
            Vector2[] vis(Vector2 p)
            {
                Vector2 p1_0; Vector2 p2_0; Vector2 p3_0; Vector2 p4_0; Vector2 p5_0;
                p1_0 = fun.Polar(p, pi / 2, dconms / 2.0 + dconms / 10.0);
                p2_0 = fun.Polar(p, pi / -2, dconms / 2.0 + dconms / 10.0);
                p3_0 = fun.Polar(p2_0, pi, 2.2 / 19.54 * lpr);
                p4_0 = fun.Polar(p1_0, pi, fun.CalDistance(p2_0, p3_0));
                p5_0 = fun.Polar(p3_0, pi / 2, dconms / 12.5);
                Vector2 p6_0 = fun.Polar(p5_0, pi - 5 * pi / 180, ((oal - lpr) / Math.Cos(5 * pi / 180)) - ((0.4 / 4.96) * (oal - lpr)));
                Vector2 p7_0 = fun.Polar(fun.Polar(p5_0, pi / 2, fun.CalDistance(p4_0, p5_0) / 2.0), pi, oal - lpr);
                Vector2 p7_1 = fun.Polar(p7_0, pi / 2, dconms);
                Vector2 p7_2 = fun.Polar(p7_0, pi / -2, dconms);
                Vector2 p7_3 = fun.Polar(p6_0, fun.CalAngle(p5_0, p6_0) - pi / 4, dconms);
                Vector2 p7_4 = fun.Inters(p6_0, p7_3, p7_1, p7_2);
                Vector2 p8_0 = fun.Polar(p4_0, pi / -2, fun.CalDistance(p3_0, p5_0));
                Vector2 p9_0 = fun.Polar(p8_0, pi + 5 * pi / 180, fun.CalDistance(p5_0, p6_0));
                Vector2 p10_0 = fun.Polar(p9_0, (-fun.CalAngle(p6_0, p7_4)), fun.CalDistance(p6_0, p7_4));
                var polyline1 = Pus.AddPointsToLwPolyLine(p8_0, p4_0, p1_0, p2_0, p3_0, p8_0, p9_0, p10_0, p7_4, p6_0, p9_0, p6_0, p5_0);
                Line line2_0 = new Line(fun.Polar(p, pi, -p1_0.X + (oal - lpr)), fun.Polar(p, 0, lpr));
                line2_0.Lineweight = Lineweight.W25;//Lineweight指线宽
                line2_0.Layer = centre;//Layer指图层
                line2_0.LinetypeScale = 5 * scale;//指线性比例
                if (p.Y == 0)
                    line2_0.Linetype = Linetype.Dashed;//Linetype指是点划线还是虚线什么的
                else
                    line2_0.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
                dxf.AddEntity(new EntityObject[] { line2_0, polyline1 }); //提取
                fun.PolyFill(dxf, polyline1, 0.5, contour);
                Vector2[] pj = { p1_0, p2_0, p3_0, p4_0, p5_0, p6_0, p7_4, p8_0, p9_0, p10_0 };
                return pj;
            }
            #endregion

            Vector2 p19 = fun.Polar(p14, pi / -2, oal);
            Vector2 p19_0 = fun.Polar(p19, pi / -2, dconms / 2.0);
            Vector2[] Random = vis(p19_0);
            Vector2 pp1 = Random[0];
            Vector2 pp2 = Random[1];
            Vector2 pp3 = Random[2];
            Vector2 pp4 = Random[3];
            Vector2 pp7 = Random[6];
            Vector2 pp8 = Random[7];
            Vector2 pp9 = Random[8];
            Vector2 p20 = fun.Polar(p19, 0, oal - lh);
            Vector2 p28 = fun.Polar(p20, pi / -2, dconms + bc);
            Vector2 p28_ = fun.Polar(p28, 0, 50);
            Vector2 p21 = fun.Polar(p20, 0, lh - ecd - bc);
            Vector2 p22 = fun.Polar(p21, -eca_, ecd / Math.Cos(eca * pi / 180));
            Vector2 p23 = fun.Polar(p22, pi / -2, wf * (1.1 / 1.23));
            Vector2 p24 = new Vector2(oal, p19.Y - dconms / 2.0 - wf);
            Vector2 p25 = fun.Polar(p24, pi, cw);
            Vector2 p25_1 = fun.Polar(p25, 0, (p24.X - p25.X) / 2.0);
            Vector2 p25_2 = fun.Polar(p25_1, pi / 2, 50);
            Vector2 p26 = new Vector2(p25.X + bc, p23.Y);
            Vector2 p26_ = fun.Polar(p26, pi / 2, 50);
            Vector2 p27 = fun.Inters(p28, p28_, p26, p26_);


            Vector2 p29 = fun.Polar(p20, pi / -2, dconms);
            Vector2 p30 = fun.Polar(p19, pi / -2, dconms);
            Vector2 p31 = fun.Polar(p26, 0, 0.06 / 0.46 * cw);
            Vector2 p32 = fun.Polar(p23, pi, 0.06 / 0.46 * cw);
            Vector2 p33 = new Vector2(p26.X + (p31.X - p26.X) / 2.0, p26.Y + (p25.Y - p26.Y) / 2.0);
            Vector2 p34 = new Vector2(p23.X + (p32.X - p23.X) / 2.0, p23.Y + (p24.Y - p23.Y) / 2.0);

            LwPolyline poly1 = new LwPolyline();
            poly1.Vertexes.Add(new LwPolylineVertex(p1));
            poly1.Vertexes.Add(new LwPolylineVertex(p2));
            poly1.Vertexes.Add(new LwPolylineVertex(p3));
            poly1.Vertexes.Add(new LwPolylineVertex(p4));
            poly1.Vertexes.Add(new LwPolylineVertex(p5));
            poly1.Vertexes.Add(new LwPolylineVertex(p6));
            poly1.Vertexes.Add(new LwPolylineVertex(p7));
            poly1.Vertexes.Add(new LwPolylineVertex(p8));
            poly1.Vertexes.Add(new LwPolylineVertex(p9));
            poly1.Vertexes.Add(new LwPolylineVertex(p10));
            poly1.Vertexes.Add(new LwPolylineVertex(p11));
            poly1.Vertexes.Add(new LwPolylineVertex(p12));
            poly1.Vertexes.Add(new LwPolylineVertex(p13));
            poly1.Vertexes.Add(new LwPolylineVertex(p14));
            poly1.Vertexes.Add(new LwPolylineVertex(p1));
            // fun.PolyFill(dxf, poly1, 0.5, contour);
            //dxf.AddEntity(poly1);

            LwPolyline poly2 = new LwPolyline();
            poly2.Vertexes.Add(new LwPolylineVertex(p4));
            poly2.Vertexes.Add(new LwPolylineVertex(p16));
            poly2.Vertexes.Add(new LwPolylineVertex(p6));
            poly2.Vertexes.Add(new LwPolylineVertex(p15));
            poly2.Vertexes.Add(new LwPolylineVertex(p17));
            poly2.Vertexes.Add(new LwPolylineVertex(p9));
            poly2.Vertexes.Add(new LwPolylineVertex(p18));
            poly2.Vertexes.Add(new LwPolylineVertex(p11));
            poly2.Vertexes.Add(new LwPolylineVertex(p12));
            poly2.Vertexes.Add(new LwPolylineVertex(p3));
            //fun.PolyFill(dxf, poly2, 0.5, contour);
            //dxf.AddEntity(poly2);



            LwPolyline poly3 = new LwPolyline();
            poly3.Vertexes.Add(new LwPolylineVertex(p19));
            poly3.Vertexes.Add(new LwPolylineVertex(p21));
            poly3.Vertexes.Add(new LwPolylineVertex(p22));
            poly3.Vertexes.Add(new LwPolylineVertex(p23));
            poly3.Vertexes.Add(new LwPolylineVertex(p24));
            poly3.Vertexes.Add(new LwPolylineVertex(p25));
            poly3.Vertexes.Add(new LwPolylineVertex(p26));
            poly3.Vertexes.Add(new LwPolylineVertex(p27));
            poly3.Vertexes.Add(new LwPolylineVertex(p28));
            poly3.Vertexes.Add(new LwPolylineVertex(p29));
            poly3.Vertexes.Add(new LwPolylineVertex(p30));
            poly3.Vertexes.Add(new LwPolylineVertex(p19));
            //dxf.AddEntity(poly3);
            fun.PolyFill(dxf, poly3, 0.5, contour);
            LwPolyline poly4 = new LwPolyline();
            poly4.Vertexes.Add(new LwPolylineVertex(p23));
            poly4.Vertexes.Add(new LwPolylineVertex(p26));
            poly4.Vertexes.Add(new LwPolylineVertex(p31));
            poly4.Vertexes.Add(new LwPolylineVertex(p33));
            poly4.Vertexes.Add(new LwPolylineVertex(p34));
            poly4.Vertexes.Add(new LwPolylineVertex(p32));
            //dxf.AddEntity(poly4);
            fun.PolyFill(dxf, poly4, 0.5, contour);
            Line line1 = new Line(p29, p20);
            fun.drawBline(dxf, line1, 0.5, contour);
            //dxf.AddEntity(line1);
            //标注
            Vector2 p35 = fun.Polar(p7, pi, lpr);
            Vector2 p36 = fun.Polar(p7, pi, cw / 2.0);
            Vector2 p37 = fun.Polar(p19, pi / -2, dconms / 2.0);
            Vector2 p38 = fun.Polar(p37, 0, oal / 2.0);
            Vector2 p39 = fun.Polar(p37, 0, oal + 5);

            Vector2 p40 = fun.Polar(p7, 60 * pi / 180, 1.7 * 0.025 * scale + 0.3);
            Vector2 p41 = fun.Polar(p40, 60 * pi / 180, dconms / 2.0);
            Vector2 p42 = fun.Polar(p41, pi / 2, 0.3);

            Vector2 p43 = fun.Polar(p36, pi / 2 + pi / 4, 1.7 * 0.025 * scale + 0.3);
            Vector2 p44 = fun.Polar(p43, pi / 2 + pi / 4, dconms);
            Vector2 p45 = fun.Polar(p44, pi / 2, 0.3);

            Vector2 p46 = fun.Polar(p0, pi + pi / 4, 1.7 * 0.025 * scale + 0.3);
            Vector2 p47 = fun.Polar(p46, pi + pi / 4, (oal / 2.0 + dconms / 2.0) / Math.Cos(pi / 4) - 0.9);
            Vector2 p48 = fun.Polar(p47, pi / -2, 1.2 + 0.3);
            Vector2 p52 = fun.Polar(p48, pi / -4, 1.2);
            Vector2 p54 = fun.Polar(p37, pi / 4, 1.7 * 0.025 * scale + 0.3);

            Vector2 p49 = fun.Polar(p35, pi + pi / 4, 1.7 * 0.025 * scale + 0.3);
            Vector2 p50 = fun.Polar(p49, pi + pi / 4, (oal / 2.0 + dconms / 2.0) / Math.Cos(pi / 4) - 0.9);
            Vector2 p51 = fun.Polar(p50, pi / -2, 1.2 + 0.3);
            Vector2 p53 = fun.Polar(p51, pi / -4, 1.2);
            Vector2 p55 = fun.Polar(p38, pi / 2 + pi / 4, 1.7 * 0.025 * scale + 0.3);

            Vector2 p56 = fun.Polar(p38, pi, oal / 4.0);
            Vector2 p57 = fun.Polar(pp9, fun.CalAngle(pp9, pp8), fun.CalDistance(pp8, pp9) / 2.0);
            Vector2 p58 = fun.Polar(p57, pi / 2 + pi / 4, dconms / 2.0);
            Vector2 p59 = fun.Polar(p58, pi / 2 + pi / 4, dconms / 2.0);

            Vector2 p60 = fun.Polar(p24, pi / -4, 1.7 * 0.025 * scale + 0.3);
            Vector2 p61 = fun.Polar(p60, pi / -4, dconms / 2.0);
            Vector2 p62 = fun.Polar(p61, pi / -4, 0.3);

            Vector2 p63 = fun.Polar(p25_1, pi + pi / 4, 1.7 * 0.025 * scale + 0.3);
            Vector2 p64 = fun.Polar(p63, pi + pi / 4, dconms);
            Vector2 p65 = fun.Polar(p64, pi / -2, 1.2 + 0.3);

            Vector2 p66 = fun.Polar(p21, 0, dconms * 1.7);
            Vector2 p67 = fun.Polar(p66, pi / -2, dconms + oal + dconms);
            Vector2 p67_ = fun.Polar(p67, pi, 1.2 * scale * 3);
            Vector2 p68 = fun.Polar(p67, pi / 2, dconms / 2.0);
            Vector2 p69 = fun.Polar(p68, pi / 2, dconms / 2.0);

            Vector2 p70 = fun.Polar(p35, pi / 2, oal / 2);
            /*
            fun.Axis(dxf, p0, 180, 90, "Z", "Y", "", 0.25 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p35, 180, 90, "Z", "Y", "", 0.25 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p36, 90, 0, "Z", "X", "", 0.25 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p37, 180, -90, "Z", "X", "", 0.25 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p38, 180, -90, "Z", "X", "", 0.25 * scale, 1.2 * scale, 0);
            fun.Axis(dxf, p25_1, 0, 90, "X", "Y", "", 0.25 * scale, 1.2 * scale, 0);
            */
            //fun.dimrot1(dxf, p35, p7, 0, oal / 3, 2, 1.2 * scale, 1.6 * scale, 0.9, "LPR,LTA", "", "");
            //fun.dimrot1(dxf, p7, fun.Polar(p7, pi / -2, 0.001), -90, dconms, 2, 1.2 * scale, 1.6 * scale, 0.9, "HTA,HF", "", "");
            fun.dimrot1(dxf, pp3, pp4, 90, dconms * 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "DCON", "", "");
            fun.dimrot1(dxf, p19 , p30 , -90, dconms /4.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "BDRED", "", "");
            fun.dimrot1(dxf, p20, p24, 0, oal / 4.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LH", "", "");
            fun.dimrot1(dxf, pp2, p24, 0, oal / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "LDRED", "", "");
           // fun.dimrot1(dxf, p21, p22, -90, dconms, 2, 1.2 * scale, 1.6 * scale, 0.9, "ECD", "", "");
            fun.dimrot1(dxf, p24, p39, -90, dconms * 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "WF", "", "");
            fun.dimrot1(dxf, p25, p24, 180, oal / 2.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "CW", "", "");
            fun.dimrot1(dxf, pp7, p24, 180, oal, 2, 1.2 * scale, 1.6 * scale, 0.9, "OAL", "", "");
            fun.dimrot1(dxf, pp3, p24, 180, oal / 1.2, 2, 1.2 * scale, 1.6 * scale, 0.9, "LPR", "", "");
            fun.dimrot1(dxf, pp3, fun.Polar(p25, 0, fun.CalDistance(p25, p24) / 2.0), 180, oal / 1.5, 2, 1.2 * scale, 1.6 * scale, 0.9, "LF", "", "");
            fun.dimrot1(dxf, p27, p25, 90, lh / 3.0, 2, 1.2 * scale, 1.6 * scale, 0.9, "CDX", "", "");

            fun.jdbz2(dxf, new Line(p21, p22), new Line(p21, fun.Polar(p21, 0, 0.1)), dconms * 1.7, 1.2 * scale, 1.6 * scale, 0.9, "ECA", "", "");
            fun.jdbz2(dxf, new Line(p24, p25), new Line(p24, fun.Polar(p24, pi / -2, 0.1)), oal / 1.5, 1.2 * scale, 1.6 * scale, 0.9, "KAPR", "", "");

            fun.Singlelinearrow(dxf, "CCTMS,CCFMS,CZCMS", p57, 135, p58, p59, 1.2 * scale, 1.6 * scale);
            /* fun.Singlelinearrow(dxf, "", p67, -90, p68, p69, 1.2 * scale, 1.6 * scale);
             */
            Line line2 = new Line(p0, p0_);
            line2.Lineweight = Lineweight.W25;//Lineweight指线宽
            line2.Layer = centre;//Layer指图层
            line2.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
                                              //dxf.AddEntity(line2);

            Line line3 = new Line(p37, p39);
            line3.Lineweight = Lineweight.W25;//Lineweight指线宽
            line3.Layer = centre;//Layer指图层
            line3.Linetype = Linetype.DashDot;//Linetype指是点划线还是虚线什么的
            dxf.AddEntity(line3);

            Line line4 = new Line(p40, p41);
            Text txt4 = new Text("CRP", p42, 1.2 * scale, 0);
            Line line5 = new Line(p43, p44);
            Text txt5 = new Text("CSW", p45, 1.2 * scale, 0);
            Line line6 = new Line(p46, p47);
            Text txt6 = new Text("PCS", p48, 1.2 * scale, 0);
            Line line7 = new Line(p49, p50);
            Text txt7 = new Text("MCS", p51, 1.2 * scale, 0);
            Line line8 = new Line(p52, p54);
            Line line9 = new Line(p53, p55);
            Line line10 = new Line(p60, p61);
            Text txt10 = new Text("CRP", p62, 1.2 * scale, 0);
            Line line11 = new Line(p63, p64);
            Text txt11 = new Text("CSW", p65, 1.2 * scale, 0);
            Text txt12 = new Text("ISYC=309-05a", p70, 1.2 * scale, 0);
            Text txt13 = new Text("FDP", p67_, 1.2 * scale, 0);


            Circle circlex = new Circle(p7, 1.7 * 0.25 * scale);
            Circle circle1 = new Circle(p24, 1.7 * 0.25 * scale);
            /*dxf.AddEntity(new EntityObject[] { circlex ,circle1 ,line4,line5,line6 ,line7,line8 ,line9 ,line10,line11 ,txt4 ,txt5 ,
            txt6 ,txt7, txt10,txt11,txt12,txt13   });*/


            double isframe = Convert.ToInt32(data["isframe"]);
            String isframe_chose = Convert.ToString(data["isframe_chose"]);
            if (isframe == 1)
            {
                if (isframe_chose.Equals("0"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA0X(dxf, new Vector2(p0.X - 1189 / 2.0, p0.Y + 841 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("1"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA1X(dxf, new Vector2(p0.X - 841 / 2.0, p0.Y + 594 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("2"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA2X(dxf, new Vector2(p0.X - 594 / 2.0, p0.Y + 420 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("3"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(p0.X - 420 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4X"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4X(dxf, new Vector2(p0.X - 297 / 2.0, p0.Y + 210 / 2.0 - 10 * 2.26), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }

                if (isframe_chose.Equals("4Y"))
                {
                    Dictionary<string, Vector2> position = Frame.frameA4Y(dxf, new Vector2(p0.X - 210 / 2.0, p0.Y + 297 / 2.0), data);
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }



            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);

        }


    }
}


